Fix 'Invalid free' detected by valgrind.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 19 Apr 2006 23:17:55 +0000 (23:17 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 19 Apr 2006 23:17:55 +0000 (23:17 +0000)
gpsbabel/geoniche.c

index e5bf8e6aa1ebe60ed5b7834a3f39354407401cb7..8ec4765ed8a2fea040a197f9a2f16e86e8d5902f 100644 (file)
@@ -630,7 +630,10 @@ geoniche_geostuff(const waypoint *wpt)
        xfree(tmp2);
        xfree(tmp3);
 
-       return enscape(gs);
+       tmp1 = enscape(gs);
+       xfree(gs);
+
+       return tmp1;
 }
 
 static void
@@ -687,10 +690,8 @@ geoniche_writewpt(const waypoint *wpt)
 
     gs = geoniche_geostuff(wpt);
     if (gs) {
-       char *newnotes = xstrappend(notes, gs);
-       xfree (notes);
+       notes = xstrappend(notes, gs);
        xfree (gs);
-       notes = newnotes;
     }
 
     vdata = (ubyte *) xmalloc(vsize);